package com.qijian.common.utils.poi.handler;

import com.qijian.common.utils.poi.ExcelHandlerAdapter;
import org.apache.commons.lang3.BooleanUtils;

import java.math.BigDecimal;

public class NumberPlusOrMinusHandler implements ExcelHandlerAdapter {
    @Override
    public Object format(Object value, String[] args) {
        if (value instanceof Number) {
            if ("+".equals(args[0]))
                return new BigDecimal(String.valueOf(value));
            else if ("-".equals(args[0]))
                return new BigDecimal(String.valueOf(value)).negate();
            else return value;
        }
        return value;
    }
}
